<%--
  Created by IntelliJ IDEA.
  User: alpha
  Date: 2024/3/25
  Time: 14:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%--<html>
<head>
    <title>Title</title>
</head>
<body>
    <h1>用户管理</h1>
    <table border="1">
        <th>
            <td>编号</td>
            <td>账号</td>
            <td>昵称</td>
            <td>创建时间</td>
        </th>
        <c:forEach items="${requestScope.list}" var="entity">
            <tr>
                <td>${entity.id}</td>
                <td>${entity.username}</td>
                <td>${entity.nickname}</td>
                <td>${entity.createTime}</td>
            </tr>
        </c:forEach>
    </table>
</body>
</html>--%>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>用户管理</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description"
          content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <!-- Sweet Alert -->
    <link href="/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>用户管理</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_basic.html#">选项1</a>
                            </li>
                            <li><a href="table_basic.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-9 m-b-xs">
                            <%--<a> href="/userServlet?action=addOrUpdatePage" class="btn btn-success" type="button">
                                <i class="fa fa-plus"></i>添加</a>--%>
                            <%--<button class="btn btn-success" type="button"><i class="fa fa-plus"></i>&nbsp;添加</button>--%>
                            <a href="/sys/userServlet?action=saveOrUpdatePage" class="btn btn-success" type="button">
                                <i class="fa fa-plus"></i>&nbsp;添加</a>
                        </div>

                        <div class="col-sm-3">
                            <form action="/sys/userServlet" id="myForm" method="get">
                                <div class="input-group">

                                    <input type="text" name="key" value="${pageUtils.key}" placeholder="请输入关键词" class="input-sm form-control">

                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                    </span>
                                    <input type="hidden" name="action" value="list">
                                    <input type="hidden" id="pageNum" name="pageNum" value="${pageUtils.pageNum}">
                                    <input type="hidden" id="pageSize" name="pageSize" value="${pageUtils.pageSize}">


                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>

                                <th></th>
                                <th>编号</th>
                                <th>账号</th>
                                <th>昵称</th>
                                <th>头像</th>
                                <th>角色</th>
                                <th>日期</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${requestScope.pageUtils.list}" var="entity">
                                <tr>
                                    <td>
                                        <input type="checkbox" class="i-checks" name="input[]">
                                    </td>
                                    <td>${entity.id}</td>
                                    <td>${entity.username}</td>
                                    <td>${entity.nickname}</td>
                                    <td><img src="/sys/downloadServlet?fileName=${entity.img}"
                                             style="width: 60px;height: 60px"></td>
                                    <td>${entity.roleName}</td>
                                    <td>${entity.createTime}</td>
                                        <%--<td><span class="pie">0.52/1.561</span></td>--%>
                                        <%--<td>20%</td>
                                        <td>2014.11.11</td>--%>
                                        <%--<a href="table_basic.html#"><i class="fa fa-check text-navy"></i></a>--%>
                                    <td>
                                            <%--<a href="/sys/userServlet?action=saveOrUpdatePage" class="btn btn-success" type="button"><i class="fa fa-plus"></i>&nbsp;添加</a>--%>
                                        <a href="/sys/userServlet?action=saveOrUpdatePage&id=${entity.id}"
                                           class="btn btn-primary" type="button"><i class="fa fa-edit"></i>更新</a>
                                        <button class="btn btn-warning" onclick="removeData(${entity.id})"
                                                type="button"><i class="fa fa-remove"></i>删除
                                        </button>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>

                    <%--<jsp:include page="/common/commonPage.jsp"/>--%>
                    <%@include file="/common/commonPage.jsp"%>

                </div>
            </div>
        </div>

    </div>
</div>

<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.7"></script>


<!-- Peity -->
<script src="/js/plugins/peity/jquery.peity.min.js"></script>

<!-- 自定义js -->
<script src="/js/content.js?v=1.0.0"></script>


<!-- iCheck -->
<script src="/js/plugins/iCheck/icheck.min.js"></script>

<!-- Peity -->
<script src="/js/demo/peity-demo.js"></script>
<!-- Sweet alert -->
<script src="/js/plugins/sweetalert/sweetalert.min.js"></script>

<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });

    function removeData(id) {
        swal({
            title: "您确定要删除这条信息吗",
            text: "删除后将无法恢复，请谨慎操作！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            closeOnConfirm: false
        }, function () {
            swal({
                title: "删除成功！",
                text: "您已经永久删除了这条信息。",
                type: "success",
                showConfirmButton: true,
                confirmButtonColor: "#00b2ff",
                confirmButtonText: "确认",
                closeOnConfirm: false,
                timer: 5000 // 设置为3000毫秒，即3秒
            }, function () {
                $.get("/sys/userServlet?action=remove&id=" + id, function (msg) {
                    /*swal("删除成功！", "您已经永久删除了这条信息。", "success",5000);*/

                    //再发起一个查询的操作
                    window.location.href = "/sys/userServlet?action=list"
                })

            });

        });
    }

    /*//分页相关的方法
    function goPre() {
        //前一页：当前页-1
        $("#pageNum").val(${pageUtils.pageNum - 1});
        //提交表单
        $("#myForm").submit();
    }

    function goNext() {
        //下一页：当前页+1
        $("#pageNum").val(${pageUtils.pageNum + 1});
        //提交表单
        $("#myForm").submit();
    }

    function goPage(page) {
        //当前页
        $("#pageNum").val(page);
        //提交表单
        $("#myForm").submit();
    }*/
</script>

</body>

</html>

